function energy_from_spectrum_width(span0,chi,CONSTS,plot_data)

    w1 = span0(1);
    w2 = span0(2); 
    dw = w2-w1;
    V0 = CONSTS.V0;
      
    num_points = 100;
    step = dw/num_points;
    refine_multiplier = 10;   
    
    span = span0;
    for i=1:num_points+1
        fprintf ('i= %d\n', i);
        span = [w1+(i-1)*step,w2];
        dw_vec(i) = span(2)-span(1);
        W_n(i) = noise_energy (chi,span,CONSTS);
    end
    
    coef_sgs_to_si = 1e-7;
    coef_sgs_to_si_V = 300;
    dw_refined_vec = linspace(dw_vec(1), dw_vec(size(dw_vec,1)), refine_multiplier*num_points)';
%     W_refined_vec = spline(dw_vec, W_n, dw_refined_vec);    
    
    if(plot_data)
        figure; plot(dw_vec./w2, (coef_sgs_to_si*W_n)./((coef_sgs_to_si_V*V0)^2), 'r-'); %, dw_refined_vec, coef_sgs_to_si*W_refined_vec, 'b-'); 
        xlabel('\Delta\omega / \omega_H'); ylabel('W, J');
    end

end